<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>会员管理系统</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link href="public/css/base.css" rel="stylesheet" type="text/css">
<link href="public/css/login.css" rel="stylesheet" type="text/css">
</head>
<?php
	include_once("../class/admin_class.php");
	session_start();
	unset($_SESSION['to_admin']);
	if ($_POST['button'])
	{
		$_admin = new admin_class();
		if ($loginadmin=$_admin->getadminbynamepass($_POST['username'],$_POST['password']))
		{
			if($_SESSION['to_admin']){
				alert("检测到您上个帐号尚未退出登录,请您先安全退出上个帐号或关闭浏览器后再尝试重新登录","?");
			}else{
				$_SESSION['to_admin']=$loginadmin['loginname'];
				$_SESSION['adminid']=$loginadmin['id'];
				$_SESSION['qx']=$loginadmin['group'];
				date_default_timezone_set('PRC');
				$_SESSION['lgdate']=date('Y-m-d H:i:s',time());
				$_SESSION['sclgdate']=$loginadmin['logindate'];
				$update_admin['logindate']=$_SESSION['lgdate'];
				$_SESSION['zq1']=$loginadmin['zq1'];
				$_SESSION['zq2']=$loginadmin['zq2'];
				$_SESSION['zq3']=$loginadmin['zq3'];
				$_SESSION['zq4']=$loginadmin['zq4'];
				$_SESSION['zq5']=$loginadmin['zq5'];
				$_SESSION['zq6']=$loginadmin['zq6'];
				$_SESSION['zq7']=$loginadmin['zq7'];
				$_SESSION['zq8']=$loginadmin['zq8'];
				$_SESSION['zq9']=$loginadmin['zq9'];
				$_SESSION['zq10']=$loginadmin['zq10'];
				$_SESSION['q1']=$loginadmin['q1'];
				$_SESSION['q2']=$loginadmin['q2'];
				$_SESSION['q3']=$loginadmin['q3'];
				$_SESSION['q4']=$loginadmin['q4'];
				$_SESSION['q5']=$loginadmin['q5'];
				$_SESSION['q6']=$loginadmin['q6'];
				$_SESSION['q7']=$loginadmin['q7'];
				$_SESSION['q8']=$loginadmin['q8'];
				$_SESSION['q9']=$loginadmin['q9'];
				$_SESSION['q10']=$loginadmin['q10'];
				$_SESSION['q11']=$loginadmin['q11'];
				$_SESSION['q12']=$loginadmin['q12'];
				$_SESSION['q13']=$loginadmin['q13'];
				$_SESSION['q14']=$loginadmin['q14'];
				$_SESSION['q15']=$loginadmin['q15'];
				$_SESSION['q16']=$loginadmin['q16'];
				$_SESSION['q17']=$loginadmin['q17'];
				$_SESSION['q18']=$loginadmin['q18'];
				$_SESSION['q19']=$loginadmin['q19'];
				$_SESSION['q20']=$loginadmin['q20'];
				$_SESSION['q21']=$loginadmin['q21'];
				$_SESSION['q22']=$loginadmin['q22'];
				$_SESSION['q23']=$loginadmin['q23'];
				$_SESSION['q24']=$loginadmin['q24'];
				$_SESSION['q25']=$loginadmin['q25'];
				$_SESSION['q26']=$loginadmin['q26'];
				$_SESSION['q27']=$loginadmin['q27'];
				$_SESSION['q28']=$loginadmin['q28'];
				$_SESSION['q29']=$loginadmin['q29'];
				$_SESSION['q30']=$loginadmin['q30'];
				$_SESSION['q31']=$loginadmin['q31'];
				$_SESSION['q32']=$loginadmin['q32'];
				$_SESSION['q33']=$loginadmin['q33'];
				$_SESSION['q34']=$loginadmin['q34'];
				$_SESSION['q35']=$loginadmin['q35'];
				$_admin->admin_update($update_admin,$loginadmin['id']);
				echo "<script language=javascript>window.location.href='main.php'</script>";	
			}
		}else{
			alert('用户名密码错误,请重新登录','?');
		}
	}
	
	if ($_GET['action']=="Quit"){
		$_SESSION['qx']="";
		$_SESSION['to_admin']="";
		$_SESSION['adminid']="";
		$_SESSION['lgdate']="";
		$_SESSION['sclgdate']="";
		$_SESSION['zq1']="";
		$_SESSION['zq2']="";
		$_SESSION['zq3']="";
		$_SESSION['zq4']="";
		$_SESSION['zq5']="";
		$_SESSION['zq6']="";
		$_SESSION['zq7']="";
		$_SESSION['zq8']="";
		$_SESSION['zq9']="";
		$_SESSION['zq10']="";
		$_SESSION['q1']="";
		$_SESSION['q2']="";
		$_SESSION['q3']="";
		$_SESSION['q4']="";
		$_SESSION['q5']="";
		$_SESSION['q6']="";
		$_SESSION['q7']="";
		$_SESSION['q8']="";
		$_SESSION['q9']="";
		$_SESSION['q10']="";
		$_SESSION['q11']="";
		$_SESSION['q12']="";
		$_SESSION['q13']="";
		$_SESSION['q14']="";
		$_SESSION['q15']="";
		$_SESSION['q16']="";
		$_SESSION['q17']="";
		$_SESSION['q18']="";
		$_SESSION['q19']="";
		$_SESSION['q20']="";
		$_SESSION['q21']="";
		$_SESSION['q22']="";
		$_SESSION['q23']="";
		$_SESSION['q24']="";
		$_SESSION['q25']="";
		$_SESSION['q26']="";
		$_SESSION['q27']="";
		$_SESSION['q28']="";
		$_SESSION['q29']="";
		$_SESSION['q30']="";
	}
?>
<body>

<div class="login">
<form action="?" method="post">
	<div class="logo"></div>
    <div class="login_form">
    	<div class="user">
        	<input class="text_value" value="" id="username" name="username" type="text">
            <input class="text_value" value="" id="password" name="password" type="password">
        </div>
        <button class="button" id="button" name="button" type="submit">登录</button>
    </div>
    
    <div id="tip"></div>
    
    </form>
</div>
<script>var basedir='public/ui/';</script>
<script src="public/ui/do.js"></script>
<script src="public/ui/config.js"></script>
<script>
Do.ready('form', function() {
	$("#form").Validform({
			ajaxPost:true,
			postonce:true,
			tiptype:function(msg,o,cssctl){
				if(!o.obj.is("form")){
					var objtip=o.obj.siblings(".Validform_checktip");
					cssctl(objtip,o.type);
					objtip.text(msg);
				}else{
					var objtip=o.obj.find("#tip");
					cssctl(objtip,o.type);
					if(o.type==2){
						window.location.href='index.php?r=admin/index/index';
					}else{
						objtip.text(msg);
					}
				}
			}
	});
});

</script>
<div style="display:none"><script src='http://v7.cnzz.com/stat.php?id=155540&web_id=155540' language='JavaScript' charset='gb2312'></script></div>
</body>
</html>